import {parseHTML} from './parser'
import {generate} from './generate'

// 将模板生成 render
function compileToFunctions(html) {
  const ast = parseHTML(html.trim())
  const code = generate(ast)

  return {
    ast,
    render: new Function(`with(this) { return ${code} }`)
  }
}

export {
  compileToFunctions
}
